<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    //VC:this.$router,属性值VueRouter类的实例，VueRouter原型对象push|replace方法

    //构造函数
    function VueRouter() {

    }

    //原型对象push方法
    VueRouter.prototype.push = function (location, resolve, reject) {
        console.log(location);
        //当前函数this是谁?
        return new Promise((resolve, reject) => {

        });
    }

    //模拟VC身上的$router属性
    let $router = new VueRouter;
    //因为$router.push,VueRouter类的实例调用的，因此this即为VueRouter实例!!!
    let result = $router.push({ name: 'search', query: { b: 2 }, params: { c: 3 } }, () => { }, () => { });




</script>